home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / programming / amiga / visualarts / source / superbitmap / superbitmap.c < prev   
Encoding:
C/C++ Source or Header  |  1995-04-02  |  15.4 KB  |  534 lines

  1. /* ******************************************************************** */
  2. /* C code generated by:                            */
  3. /* Visual Arts Version 2.1                        */
  4. /* Copyright 1994-95 Danny Y. Wong  All rights reserved            */
  5. /* Calgary, Alberta (CANADA)                                    */
  6. /* Partial of the code is copyright by Jaba Development            */
  7. /* ******************************************************************** */
  8.  
  9. #include <VisualArts.h>
  10. #include <clib/VisualArts_protos.h>
  11.  
  12. #define ID_ObjID7                                     0
  13. #define ID_ObjID8                                     1
  14.  
  15. #define SuperBitMapDepth                        2
  16. #define SuperBitMapMaxX                        640
  17. #define SuperBitMapMaxY                        200
  18. #define ID_SuperBitMapLeft                        2
  19. #define ID_SuperBitMapRight                    3
  20. #define ID_SuperBitMapUp                        4
  21. #define ID_SuperBitMapDown                        5
  22. #define ID_SuperBitMapHoriz                    6
  23. #define ID_SuperBitMapVert                        7
  24.  
  25. #define SuperBitMapNumGads                        2
  26.  
  27. #include "SuperBitmap_func.c" 
  28.  
  29. #include "SuperBitmap_images.c" 
  30.  
  31. int ObjID7Obj(struct VAobject VAObject);
  32. int ObjID8Obj(struct VAobject VAObject);
  33.  
  34. BOOL SetupSuperBitMapScrollerWindow(void);
  35. void SuperBitMapScrollBitmap(ULONG x, ULONG y);
  36. void SuperBitMapInitNewBitmap(void);
  37. void SuperBitMapFreeBitmap(void);
  38. void SuperBitMapdoNewSize(void);
  39. int GetPubScreen(void);
  40. void ClosePubScreen(void);
  41. int OpenSuperBitMapWindow(char windtitle[]);
  42. void CloseSuperBitMapWindow(void);
  43. int SuperBitMapHandler(void);
  44. int SuperBitMapMainHandler(void);
  45. void DrawSuperBitMapObjs(void);
  46. int main(int argc, char *argv[]);
  47.  
  48. Object *SuperBitMapSizeImage  = NULL,  *SuperBitMapLeftImage = NULL,
  49.        *SuperBitMapRightImage = NULL,  *SuperBitMapUpImage   = NULL,
  50.        *SuperBitMapDownImage  = NULL;
  51. struct Gadget *SuperBitMapHorizGadget = NULL, *SuperBitMapVertGadget  = NULL,
  52.               *SuperBitMapLeftGadget  = NULL, *SuperBitMapRightGadget = NULL,
  53.               *SuperBitMapUpGadget    = NULL, *SuperBitMapDownGadget  = NULL;
  54. struct BitMap            *SuperBitMapBitmap = NULL;
  55. UBYTE                *PubScrName = "Workbench";
  56. struct DrawInfo            *ScrDrawInfo = NULL;
  57. APTR                 VisualInfo = NULL;
  58. struct Screen            *Scr = NULL;
  59. struct Window            *SuperBitMapWnd = NULL;
  60. struct Gadget            *SuperBitMapGList = NULL;
  61. struct Gadget            *SuperBitMapGadgets[SuperBitMapNumGads];
  62. struct IntuiMessage         SuperBitMapMsg;
  63. UWORD                 SuperBitMapLeft = 97;
  64. UWORD                 SuperBitMapTop = 46;
  65. UWORD                 SuperBitMapWidth = 395;
  66. UWORD                 SuperBitMapHeight = 129;
  67. struct TextAttr topaz8 = { (STRPTR)"topaz.font", 8, 0x00, 0x01 };
  68. struct TextAttr topaz800 = { (STRPTR)"topaz.font", 8, 0x00, 0x00 };
  69.  
  70. WORD SuperBitMapGadTypes[] = {
  71.     BUTTON_KIND,
  72.     CHECKBOX_KIND,
  73. };
  74.  
  75. struct NewGadget SuperBitMapNGads[] = {
  76.     269, 10, 91, 12, (UBYTE *)"Button",&topaz800, ID_ObjID7, PLACETEXT_IN, NULL, (APTR)ObjID7Obj,
  77.     334, 89, 26, 11, (UBYTE *)"Cool!", &topaz800, ID_ObjID8, PLACETEXT_LEFT, NULL, (APTR)ObjID8Obj,
  78. };
  79.  
  80. ULONG SuperBitMapNTags[] = {
  81.     TAG_DONE,
  82.     TAG_DONE,
  83. };
  84.  
  85.  
  86. int GetPubScreen(void)
  87. {
  88.   if (!(Scr = LockPubScreen(PubScrName)))
  89.     return(1L);
  90.  
  91.   if (!(VisualInfo = GetVisualInfo(Scr, TAG_DONE)))
  92.     return(2L);
  93.  
  94.   if (!(ScrDrawInfo = GetScreenDrawInfo(Scr)))
  95.     return(3L);
  96.   return(0L);
  97. }
  98.  
  99. void ClosePubScreen(void)
  100. {
  101.   if (VisualInfo)
  102.     FreeVisualInfo(VisualInfo);
  103.   if (Scr)
  104.     UnlockPubScreen(NULL,  Scr);
  105.   if (ScrDrawInfo)
  106.     FreeScreenDrawInfo(Scr,  ScrDrawInfo);
  107. }
  108.  
  109. BOOL SetupSuperBitMapScrollerWindow(void)
  110. {
  111.   ULONG resolution = SysISize();
  112.   WORD topborder = Scr->WBorTop + Scr->Font->ta_YSize + 1;
  113.   WORD w = IM(SuperBitMapSizeImage)->Width;
  114.   WORD h = IM(SuperBitMapSizeImage)->Height;
  115.   WORD bw = resolution == SYSISIZE_LOWRES ? 1 : 2;
  116.   WORD bh = resolution == SYSISIZE_HIRES ? 2 : 1;
  117.   WORD rw = resolution == SYSISIZE_HIRES ? 3 : 2;
  118.   WORD rh = resolution == SYSISIZE_HIRES ? 2 : 1;
  119.   WORD gw = 0, gh = 0, gap = 0;
  120.  
  121.   gh = MAX(IM(SuperBitMapLeftImage)->Height, h);
  122.   gh = MAX(IM(SuperBitMapRightImage)->Height, gh);
  123.   gw = MAX(IM(SuperBitMapUpImage)->Width, w);
  124.   gw = MAX(IM(SuperBitMapDownImage)->Width, gw);
  125.  /* If you have gadgets in the left window border, set 'gap' to the
  126.       * width of these gadgets. */
  127.   gap = 1;
  128.  
  129.   SuperBitMapHorizGadget = NewPropObject(FREEHORIZ,
  130.     GA_ID, ID_SuperBitMapHoriz,
  131.     GA_Left, rw + gap,
  132.     GA_RelBottom, bh - gh + 2,
  133.     GA_RelWidth, -gw - gap - IM(SuperBitMapLeftImage)->Width - IM(SuperBitMapRightImage)->Width - rw - rw,
  134.     GA_Height, gh - bh - bh - 2,
  135.     GA_BottomBorder, TRUE,
  136.     GA_Immediate, TRUE,
  137.     GA_RelVerify, TRUE,
  138.     GA_GZZGadget, TRUE,
  139.     GA_UserData, NULL,
  140.     ICA_TARGET, ICTARGET_IDCMP,
  141.     TAG_DONE);
  142.  
  143.   SuperBitMapVertGadget = NewPropObject(FREEVERT,
  144.     GA_ID, ID_SuperBitMapVert,
  145.     GA_RelRight, bw - gw + 3,
  146.     GA_Top, topborder + rh,
  147.     GA_Width, gw - bw - bw - 4,
  148.     GA_RelHeight, -topborder - h - IM(SuperBitMapUpImage)->Height - IM(SuperBitMapDownImage)->Height - rh - rh,
  149.     GA_RightBorder, TRUE,
  150.     GA_Previous, SuperBitMapHorizGadget,
  151.     GA_Immediate, TRUE,
  152.     GA_RelVerify, TRUE,
  153.     GA_GZZGadget, TRUE,
  154.     GA_UserData, NULL,
  155.     ICA_TARGET, ICTARGET_IDCMP,
  156.     TAG_DONE);
  157.  
  158.   SuperBitMapLeftGadget = NewButtonObject(SuperBitMapLeftImage,
  159.     GA_ID, ID_SuperBitMapLeft,
  160.     GA_RelRight, 1 - IM(SuperBitMapLeftImage)->Width - IM(SuperBitMapRightImage)->Width - gw,
  161.     GA_RelBottom, 1 - IM(SuperBitMapLeftImage)->Height,
  162.     GA_BottomBorder, TRUE,
  163.     GA_Previous, SuperBitMapVertGadget,
  164.     GA_Immediate, TRUE,
  165.     GA_RelVerify, TRUE,
  166.     GA_GZZGadget, TRUE,
  167.     GA_UserData, NULL,
  168.     ICA_TARGET, ICTARGET_IDCMP,
  169.     TAG_DONE);
  170.  
  171.   SuperBitMapRightGadget = NewButtonObject(SuperBitMapRightImage,
  172.     GA_ID, ID_SuperBitMapRight,
  173.     GA_RelRight, 1 - IM(SuperBitMapRightImage)->Width - gw,
  174.     GA_RelBottom, 1 - IM(SuperBitMapRightImage)->Height,
  175.     GA_BottomBorder, TRUE,
  176.     GA_Previous, SuperBitMapLeftGadget,
  177.     GA_Immediate, TRUE,
  178.     GA_RelVerify, TRUE,
  179.     GA_GZZGadget, TRUE,
  180.     GA_UserData, NULL,
  181.     ICA_TARGET, ICTARGET_IDCMP,
  182.     TAG_DONE);
  183.  
  184.   SuperBitMapUpGadget = NewButtonObject(SuperBitMapUpImage,
  185.     GA_ID, ID_SuperBitMapUp,
  186.     GA_RelRight, 1 - IM(SuperBitMapUpImage)->Width,
  187.     GA_RelBottom, 1 - IM(SuperBitMapUpImage)->Height - IM(SuperBitMapDownImage)->Height - h,
  188.     GA_RightBorder, TRUE,
  189.     GA_Previous, SuperBitMapRightGadget,
  190.     GA_Immediate, TRUE,
  191.     GA_RelVerify, TRUE,
  192.     GA_GZZGadget, TRUE,
  193.     GA_UserData, NULL,
  194.     ICA_TARGET, ICTARGET_IDCMP,
  195.     TAG_DONE);
  196.  
  197.   SuperBitMapDownGadget = NewButtonObject(SuperBitMapDownImage,
  198.     GA_ID, ID_SuperBitMapDown,
  199.     GA_RelRight, 1 - IM(SuperBitMapDownImage)->Width,
  200.     GA_RelBottom, 1 - IM(SuperBitMapDownImage)->Height - h,
  201.     GA_RightBorder, TRUE,
  202.     GA_Previous, SuperBitMapUpGadget,
  203.     GA_Immediate, TRUE,
  204.     GA_RelVerify, TRUE,
  205.     GA_GZZGadget, TRUE,
  206.     GA_UserData, NULL,
  207.     ICA_TARGET, ICTARGET_IDCMP,
  208.     TAG_DONE);
  209.  
  210.   if (!SuperBitMapSizeImage || !SuperBitMapLeftImage || !SuperBitMapRightImage || 
  211.       !SuperBitMapUpImage   || !SuperBitMapDownImage)
  212.     return(FALSE);
  213.   if (SuperBitMapDownGadget)
  214.     return(TRUE);
  215.   return(FALSE);
  216. }
  217.  
  218. int OpenSuperBitMapWindow(char windtitle[80])
  219. {
  220.   struct NewGadget    NewGad;
  221.   struct Gadget       *Gad;
  222.   register UWORD i, j;
  223.   UWORD offsetx = Scr->WBorLeft;
  224.   UWORD offsety = Scr->WBorTop + Scr->Font->ta_YSize + 1;
  225.  
  226.   SuperBitMapInitNewBitmap();
  227.   if (SuperBitMapBitmap == NULL)
  228.     return(1L);  
  229.   SuperBitMapSizeImage  = NewImageObject(SIZEIMAGE);
  230.   SuperBitMapLeftImage  = NewImageObject(LEFTIMAGE);
  231.   SuperBitMapRightImage = NewImageObject(RIGHTIMAGE);
  232.   SuperBitMapUpImage    = NewImageObject(UPIMAGE);
  233.   SuperBitMapDownImage  = NewImageObject(DOWNIMAGE);
  234.  
  235.   if (!SetupSuperBitMapScrollerWindow())
  236.     return(1L);
  237.   if (!(Gad = CreateContext(&SuperBitMapGList)))
  238.       return(1L);
  239.  
  240.   for (i=0, j=0; i < SuperBitMapNumGads; i++)
  241.   {
  242.     CopyMem((char *)&SuperBitMapNGads[i], (char *)&NewGad, (long)sizeof(struct NewGadget));
  243.  
  244.     NewGad.ng_VisualInfo = VisualInfo;
  245.     NewGad.ng_LeftEdge += offsetx;
  246.     NewGad.ng_TopEdge  += offsety;
  247.  
  248.     SuperBitMapGadgets[i] = Gad = CreateGadgetA((ULONG)SuperBitMapGadTypes[i], Gad, &NewGad,
  249.     (struct TagItem *)&SuperBitMapNTags[j]);
  250.     while (SuperBitMapNTags[j])
  251.         j +=2;
  252.     j++;
  253.     if (!Gad)
  254.        return(2L);
  255.   }
  256.   SuperBitMapGadgets[i-1]->NextGadget = SuperBitMapHorizGadget;
  257.   if (!(SuperBitMapWnd = OpenWindowTags(NULL,
  258.       WA_Left,    SuperBitMapLeft,
  259.       WA_Top,     SuperBitMapTop,
  260.       WA_Width,    SuperBitMapWidth,
  261.       WA_Height,    SuperBitMapHeight + kWindowOffSetY,
  262.       WA_NewLookMenus, TRUE,
  263.       WA_IDCMP,    IDCMP_CLOSEWINDOW |  IDCMP_NEWSIZE | IDCMP_GADGETUP |  IDCMP_IDCMPUPDATE ,
  264.       WA_Flags,    WFLG_CLOSEGADGET | WFLG_SIZEGADGET | WFLG_SIZEBBOTTOM |
  265.             WFLG_SIZEBRIGHT | WFLG_DEPTHGADGET  |  WFLG_SMART_REFRESH | 
  266.              WFLG_RMBTRAP |  WFLG_ACTIVATE | 
  267.              WFLG_DRAGBAR | 
  268.             WFLG_GIMMEZEROZERO | WFLG_SUPER_BITMAP ,
  269.       WA_Gadgets,    SuperBitMapGList,
  270.       WA_Title,    windtitle,
  271.       WA_ScreenTitle,    "Visual Arts V2.2 Copyright 1994-95 Danny Y. Wong  All Rights Reserved.",
  272.       WA_PubScreen,    Scr,
  273.       WA_MinWidth,    160,
  274.       WA_MinHeight,    50,
  275.       WA_MaxWidth,    640,
  276.       WA_MaxHeight,    200,
  277.       WA_SuperBitMap,    SuperBitMapBitmap,
  278.       TAG_DONE)))
  279.           return(3L);
  280.  
  281.   InitTempArea();
  282.   SuperBitMapWnd->RPort->TmpRas=&Temprast;
  283.   SuperBitMapWnd->RPort->AreaInfo=&areaInfo;
  284.   DrawSuperBitMapObjs();
  285.   DrawImage(SuperBitMapWnd->RPort, &VALogo1Image, 68, 31 + kWindowOffSetY);
  286.   SuperBitMapdoNewSize();
  287.   GT_RefreshWindow(SuperBitMapWnd, NULL);
  288.   RefreshGadgets(SuperBitMapGadgets[0], SuperBitMapWnd, NULL);
  289.   return(0L);
  290. }
  291.  
  292. void CloseSuperBitMapWindow(void)
  293. {
  294.   if (SuperBitMapWnd)
  295.     CloseWindow(SuperBitMapWnd);
  296.   if (SuperBitMapGList)
  297.     FreeGadgets(SuperBitMapGList);
  298.   if (SuperBitMapBitmap)
  299.     SuperBitMapFreeBitmap();
  300.   DisposeObject(SuperBitMapHorizGadget);
  301.   DisposeObject(SuperBitMapVertGadget);
  302.   DisposeObject(SuperBitMapLeftGadget);
  303.   DisposeObject(SuperBitMapRightGadget);
  304.   DisposeObject(SuperBitMapUpGadget);
  305.   DisposeObject(SuperBitMapDownGadget);
  306.   DisposeObject(SuperBitMapSizeImage);
  307.   DisposeObject(SuperBitMapLeftImage);
  308.   DisposeObject(SuperBitMapRightImage);
  309.   DisposeObject(SuperBitMapUpImage);
  310.   DisposeObject(SuperBitMapDownImage);
  311. }
  312.  
  313. int SuperBitMapHandler(void)
  314. {
  315.   struct IntuiMessage    *msg;
  316.   struct TagItem *TagList = NULL;
  317.   ULONG temp=0, dx=0, dy=0;
  318.   struct VAobject    VAObject;
  319.   int running    = 1;
  320.   int (*func)(struct VAobject VAObject);
  321.   ULONG class;
  322.   UWORD code;
  323.  
  324.   while (msg=GT_GetIMsg(SuperBitMapWnd->UserPort))
  325.   {
  326.     CopyMem((char *)msg, (char *)&SuperBitMapMsg, (long)sizeof(struct IntuiMessage));
  327.     TagList = (struct TagItem *)msg->IAddress;
  328.     class = msg->Class;
  329.     code  = msg->Code;
  330.  
  331.     VAObject.va_Window = (struct Window *)SuperBitMapWnd;
  332.     VAObject.va_Gadget = (struct Gadget *)msg->IAddress;
  333.     VAObject.va_IntuiMsg = (struct IntuiMessage *)msg;
  334.     VAObject.va_Flags = 0;
  335.     VAObject.va_UserData = 0;
  336.  
  337.     GT_ReplyIMsg(msg);
  338.     switch(class)
  339.     {
  340.  
  341.       case IDCMP_NEWSIZE:
  342.        SuperBitMapdoNewSize();
  343.        break;
  344.  
  345.       case IDCMP_IDCMPUPDATE:
  346.         switch(GetTagData(GA_ID, 0, TagList))
  347.         {
  348.         case ID_SuperBitMapHoriz:
  349.            temp = SuperBitMapMaxX - SuperBitMapWnd->GZZWidth;
  350.            temp = temp * ((struct PropInfo *)SuperBitMapHorizGadget->SpecialInfo)->HorizPot;
  351.            temp = temp / MAX_LEVEL;
  352.            dx   = temp - LAYERXOFFSET(SuperBitMapWnd);
  353.            if (dx)
  354.               SuperBitMapScrollBitmap(dx, 0);
  355.            break;
  356.  
  357.         case ID_SuperBitMapVert:
  358.            temp = SuperBitMapMaxY - SuperBitMapWnd->GZZHeight;
  359.            temp = temp * ((struct PropInfo *)SuperBitMapVertGadget->SpecialInfo)->VertPot;
  360.            temp = temp / MAX_LEVEL;
  361.            dy   = temp - LAYERYOFFSET(SuperBitMapWnd);
  362.            if (dy)
  363.               SuperBitMapScrollBitmap(0, dy);
  364.            break;
  365.  
  366.         case ID_SuperBitMapLeft:
  367.           if (LAYERXOFFSET(SuperBitMapWnd) > 4)
  368.           {
  369.              SuperBitMapScrollBitmap(-5, 0);
  370.             NewModifyProp(SuperBitMapHorizGadget, SuperBitMapWnd, NULL, AUTOKNOB | FREEHORIZ,
  371.             (MAX_LEVEL * LAYERXOFFSET(SuperBitMapWnd)) / 
  372.             (SuperBitMapMaxX - SuperBitMapWnd->GZZWidth), NULL,
  373.             (MAX_LEVEL * SuperBitMapWnd->GZZWidth) / SuperBitMapMaxX,
  374.             MAX_LEVEL, 1);
  375.           }
  376.           break;
  377.         case ID_SuperBitMapRight:
  378.           if ((SuperBitMapWnd->GZZWidth + LAYERXOFFSET(SuperBitMapWnd)) < SuperBitMapMaxX - 6)
  379.           {
  380.               SuperBitMapScrollBitmap(5, 0);
  381.             NewModifyProp(SuperBitMapHorizGadget, SuperBitMapWnd, NULL, AUTOKNOB | FREEHORIZ,
  382.             (MAX_LEVEL * LAYERXOFFSET(SuperBitMapWnd)) / 
  383.             (SuperBitMapMaxX - SuperBitMapWnd->GZZWidth), NULL,
  384.             (MAX_LEVEL * SuperBitMapWnd->GZZWidth) / SuperBitMapMaxX,
  385.             MAX_LEVEL, 1);
  386.           }
  387.           break;
  388.         case ID_SuperBitMapUp:
  389.           if (LAYERYOFFSET(SuperBitMapWnd) > 2)
  390.           {
  391.               SuperBitMapScrollBitmap(0, -3);
  392.             NewModifyProp(SuperBitMapVertGadget, SuperBitMapWnd, NULL, AUTOKNOB | FREEVERT,
  393.             NULL, (MAX_LEVEL * LAYERYOFFSET(SuperBitMapWnd)) / 
  394.             (SuperBitMapMaxY - SuperBitMapWnd->GZZHeight), MAX_LEVEL,
  395.             (MAX_LEVEL * SuperBitMapWnd->GZZHeight) / SuperBitMapMaxY,
  396.             1);
  397.           }
  398.           break;
  399.         case ID_SuperBitMapDown:
  400.           if ((SuperBitMapWnd->GZZHeight + LAYERYOFFSET(SuperBitMapWnd)) < SuperBitMapMaxY - 3)
  401.           {
  402.               SuperBitMapScrollBitmap(0, 3);
  403.             NewModifyProp(SuperBitMapVertGadget, SuperBitMapWnd, NULL, AUTOKNOB | FREEVERT,
  404.             NULL, (MAX_LEVEL * LAYERYOFFSET(SuperBitMapWnd)) / 
  405.             (SuperBitMapMaxY - SuperBitMapWnd->GZZHeight), MAX_LEVEL,
  406.             (MAX_LEVEL * SuperBitMapWnd->GZZHeight) / SuperBitMapMaxY,
  407.             1);
  408.           }
  409.           break;
  410.         }
  411.         break;
  412.  
  413.       case IDCMP_CLOSEWINDOW:
  414.          return(0);
  415.          break;
  416.  
  417.       case IDCMP_GADGETUP:
  418.         func = (void *)((struct Gadget *)SuperBitMapMsg.IAddress)->UserData;
  419.         if (func != NULL)
  420.           running =  func(VAObject);
  421.         break;
  422.  
  423.     }
  424.   }
  425.   return(running);
  426. }
  427.  
  428. void DrawSuperBitMapObjs(void)
  429. {
  430.   SuperBitMapDrawRects(SuperBitMapWnd);
  431.   SuperBitMapDrawCircles(SuperBitMapWnd);
  432.   SuperBitMapDrawLine(SuperBitMapWnd);
  433.  
  434. }
  435.  
  436. int SuperBitMapMainHandler(void)
  437. {
  438.   int running = 1;
  439.   ULONG windsig, signals;
  440.  
  441.   windsig = 1L << SuperBitMapWnd->UserPort->mp_SigBit;
  442.  
  443.   while (running == 1)
  444.   {
  445.     signals = Wait( windsig );
  446.     if (signals & windsig)
  447.     {
  448.       running = SuperBitMapHandler();
  449.     }
  450.   }
  451.   return(running);
  452. }
  453.  
  454. int main(int argc, char *argv[])
  455. {
  456.   int rc;
  457.  
  458.   if (!(GetPubScreen()))
  459.   {
  460.     if (!(OpenSuperBitMapWindow("SuperBitMap Demo")))
  461.     {
  462.       rc = SuperBitMapMainHandler();
  463.       CloseSuperBitMapWindow();
  464.     }
  465.     ClosePubScreen();
  466.   }
  467.   return(0L);
  468. }
  469.  
  470. void SuperBitMapdoNewSize(void)
  471. {
  472.      ULONG temp;
  473.  
  474.      temp = LAYERXOFFSET(SuperBitMapWnd) + SuperBitMapWnd->GZZWidth;
  475.      if (temp >= SuperBitMapMaxX)
  476.        SuperBitMapScrollBitmap(SuperBitMapMaxX - temp, 0);
  477.  
  478.      NewModifyProp(SuperBitMapHorizGadget, SuperBitMapWnd, NULL, AUTOKNOB | FREEHORIZ,
  479.         (MAX_LEVEL * LAYERXOFFSET(SuperBitMapWnd)) / 
  480.         (SuperBitMapMaxX - SuperBitMapWnd->GZZWidth),
  481.          NULL,
  482.         (MAX_LEVEL * SuperBitMapWnd->GZZWidth) / SuperBitMapMaxX,
  483.          MAX_LEVEL, 1);
  484.  
  485.      temp = LAYERYOFFSET(SuperBitMapWnd) + SuperBitMapWnd->GZZHeight;
  486.      if (temp >= SuperBitMapMaxY)
  487.       SuperBitMapScrollBitmap(0, SuperBitMapMaxY - temp);
  488.  
  489.      NewModifyProp(SuperBitMapVertGadget, SuperBitMapWnd, NULL, AUTOKNOB | FREEVERT,
  490.          NULL,
  491.         (MAX_LEVEL * LAYERYOFFSET(SuperBitMapWnd)) / 
  492.         (SuperBitMapMaxY - SuperBitMapWnd->GZZHeight),
  493.          MAX_LEVEL,
  494.         (MAX_LEVEL * SuperBitMapWnd->GZZHeight) / SuperBitMapMaxY,
  495.          1);
  496. }
  497.  
  498. void SuperBitMapFreeBitmap(void)
  499. {
  500.     short x;
  501.  
  502.     for (x=0; x < SuperBitMapDepth; x++)
  503.     {
  504.          if (SuperBitMapBitmap->Planes[x] != NULL)
  505.         FreeRaster(SuperBitMapBitmap->Planes[x], SuperBitMapMaxX, SuperBitMapMaxY);
  506.     }
  507.     FreeMem(SuperBitMapBitmap, sizeof(struct BitMap));
  508.     SuperBitMapBitmap = NULL;
  509. }
  510.  
  511.  
  512. void SuperBitMapInitNewBitmap(void)
  513. {
  514.     short x;
  515.  
  516.     if (SuperBitMapBitmap = AllocMem(sizeof(struct BitMap), MEMF_PUBLIC | MEMF_CLEAR))
  517.     {
  518.        InitBitMap(SuperBitMapBitmap, SuperBitMapDepth, SuperBitMapMaxX, SuperBitMapMaxY);
  519.        for (x=0; x < SuperBitMapDepth; x++)
  520.        {
  521.          if ((SuperBitMapBitmap->Planes[x] = AllocRaster(SuperBitMapMaxX, SuperBitMapMaxY)) == NULL)
  522.         return;
  523.          BltClear(SuperBitMapBitmap->Planes[x], RASSIZE(SuperBitMapMaxX, SuperBitMapMaxY), 0);
  524.        }
  525.     }
  526. }
  527.  
  528.  
  529. void SuperBitMapScrollBitmap(ULONG x, ULONG y)
  530. {
  531.     ScrollLayer(0, SuperBitMapWnd->RPort->Layer, x ,y);
  532.     WaitTOF();
  533. }
  534.